#!/bin/bash

echo "正在启动校园报修系统前端..."
echo

# 检查Node.js是否安装
if ! command -v node &> /dev/null; then
    echo "错误：未检测到Node.js，请先安装Node.js"
    exit 1
fi

# 检查npm是否安装
if ! command -v npm &> /dev/null; then
    echo "错误：未检测到npm，请先安装npm"
    exit 1
fi

echo "正在安装依赖..."
npm install

if [ $? -ne 0 ]; then
    echo "错误：依赖安装失败"
    exit 1
fi

echo
echo "依赖安装完成，正在启动开发服务器..."
echo "前端地址：http://localhost:8080"
echo "请确保后端服务运行在 http://localhost:3000"
echo

npm run dev 